<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
    <meta charset="UTF-8">


    <title>Title</title>


    <link rel="stylesheet" href="__PUBLIC__/js/jquery-easyui-1.5.1/themes/default/easyui.css">
    <link rel="stylesheet" href="__PUBLIC__/js/jquery-easyui-1.5.1/themes/icon.css">

    <script src="__PUBLIC__/js/jquery-easyui-1.5.1/jquery.min.js"></script>
    <script src="__PUBLIC__/js/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
    <script src="__PUBLIC__/js/jquery-easyui-1.5.1/locale/easyui-lang-zh_CN.js"></script>
    <script src="__PUBLIC__/js/jquery-easyui-1.5.1/plugins/jquery.layout.js"></script>


</head>
<body>
<notempty name="Think.session.islogin">
    <a href="{:U('home/login/loginout')}">注销</a>
    <a href="#" onclick="$.messager.prompt('提示信息', '请输入你的新密码：', function(r){
	if (r){
		$.post('{:U(';home/login/changepwd;')}',{pwd:r},
		function(data,status){
		$.messager.alert('信息',data.info);
		self.location='/gs_php/home/login/loginout';




		};)
	}
});

">更改密码</a>
</notempty>

<div id="cc" class="easyui-layout" fit="true">
    <!--<div data-options="region:'north',title:'North Title',noheader:true" style="height:100px;">-->

        <!--<a href="#" id="login_btn" onclick="$('#pp').panel('open')">登录</a>-->
        <!--<div id="loginout_div">-->
            <!--<label id="userinfo"></label>-->
            <!--<a href="{:U('Index/Index/Loginout')}" id="loginout_btn">登出</a>-->
        <!--</div>-->


        <!--&lt;!&ndash;   登录的界面的代码                          &ndash;&gt;-->
        <!--<div id="pp" class="easyui-window" title="My Window" closed="true" style="width:380px;height:250px"-->
             <!--data-options="iconCls:'icon-save',modal:true">-->
            <!--<form style="padding:10px 20px 10px 40px;">-->
                <!--<p>Name: <input type="text" id="login_username" name="login_username"></p>-->
                <!--<p>Pass: <input type="password" id="login_pwd" name="login_pwd"></p>-->
                <!--<p>Pass: <input type="text" id="login_verify" name="login_verify">-->
                    <!--<img id="imgvcode" onclick="refresh()" src="{:U('Index/Index/verify')} ">-->
                    <!--<a href="#" onclick="refresh()">看不清</a>-->
                <!--</p>-->
                <!--<div style="padding:5px;text-align:center;">-->
                    <!--<a href="#" class="easyui-linkbutton" id="w_login_btn" icon="icon-ok">Ok</a>-->
                    <!--<a href="#" class="easyui-linkbutton" icon="icon-cancel">Cancel</a>-->
                <!--</div>-->
            <!--</form>-->
        <!--</div>-->
        <!--&lt;!&ndash;   登录的界面的代码                          &ndash;&gt;-->
    <!--</div>-->


    <div data-options="region:'west',title:'West',split:true" style="width:200px;">
        <ul class="easyui-tree">
            <li>
                <span>工单管理</span>
                <ul>
                    <li class="menu-item"><a href="#" onclick="addTab('工单记录','{:U(';Home/record/index;')}';)">工单记录</a>
                    </li>
                    <li class="menu-item"><a href="#" onclick="addTab('添加工单','{:U(';Home/record/add;')}';)">添加工单</a>
                    </li>

                    <li class="menu-item"><a href="#" onclick="addTab('请假记录','{:U(';Home/leave/index;')}';)">请假记录</a>

                    </li>

                    <notempty name="Think.session.islogin">
                        <li class="menu-item"><a href="#"
                                                 onclick="addTab('工时记录','{:U(';Home/gsvalue/index;')}';)">统计记录</a>
                        </li>
                    </notempty>

                </ul>
            </li>

            <notempty name="Think.session.islogin">
                <li>
                    <span>菜单管理</span>
                    <ul>
                        <li class="menu-item"><a href="#"
                                                 onclick="addTab('站点管理','{:U(';station/addstation;')}';)">站点管理</a>
                        </li>
                        <li class="menu-item"><a href="#"
                                                 onclick="addTab('成员管理','{:U(';Home/Member/index;')}';)">成员管理</a>
                        </li>

                    </ul>
                </li>
            </notempty>


        </ul>
    </div>
    <div data-options="region:'center',title:'center title' " border="false" noheader="true"
         style="padding:5px;background:#eee;">
        <div id="tt" class="easyui-tabs"  data-options="justified:true"  fit="true" style="width:100%;height:100%;">
            <div title="主页" style="padding:20px;display:none;">
                <p style="display: block;font-size: large">
                    欢迎到来</p>
            </div>

        </div>
    </div>
</div>

</body>
<script>


    function addTab(title, href) {
        var tt = $('#tt');

        if (tt.tabs('exists', title)) {       
            tt.tabs('select', title);
            var tab = $('#tt').tabs('getSelected');  // 获取选择的面板
             tab.panel('refresh');

            // refreshTab({tabTitle:title,url:href});
            }
        else
            {
                if (href) {
                    var content = '<iframe style="width:100%;height:100%;" scrolling="auto" frameborder="0" src="' + href + '"></iframe>';
                } else {
                    var content = '未实现';
                }
                tt.tabs('add', {
                    title:title,
                    closable: true,
                    content: content,

                });
            }
   }
   function closeatab() {
       var tab=$('#tt').tabs('getSelected');//获取当前选中tabs
       var index = $('#tt').tabs('getTabIndex',tab);//获取当前选中tabs的index
       $('#tt').tabs('close',index);//关闭对应index的tabs
       testff();
   }
    function testff(){
        var tab=$('#tt').tabs('getTab','工单记录');
        var win= tab.find('iframe')[0].contentWindow;
        win.cl();
    }

    function refreshTab(cfg){
        var refresh_tab = cfg.tabTitle?$('#tt').tabs('getTab',cfg.tabTitle):$('#tt').tabs('getSelected');
        if(refresh_tab && refresh_tab.find('iframe').length > 0){
            var _refresh_ifram = refresh_tab.find('iframe')[0];
            var refresh_url = cfg.url?cfg.url:_refresh_ifram.src;
            //_refresh_ifram.src = refresh_url;  
            _refresh_ifram.contentWindow.location.href=refresh_url;
        }
    }


    //刷新验证码
    function refresh() {
        $("#imgvcode").attr("src", "{:U('Index/Index/verify')}" + "?rid=" + Math.random());

    }

    function getUserinfo() {
        $.get(
            "{:U('Index/Index/getUserInfo')}",
            function (result) {
                if (result['uid'] != null) {
                    $("#login_btn").hide();
                    $("#userinfo").text(result['username'] + ",你好");
                    $("#loginout_div").show();
                }
                else {
                    $("#login_btn").show();
                    $("#loginout_div").hide();
                }

            });


    }
    $(function () {

        $('#w_login_btn').click(function () {

            var _login_username = $('#login_username').val();
            var _login_userpwd = $('#login_pwd').val();
            var _login_verify = $('#login_verify').val();

            $.post("{:U('Index/Index/Login')}", {
                    username: _login_username,
                    userpwd: _login_userpwd,
                    verify: _login_verify
                },
                function (data) {
                    alert(data.msg);
                    if (data.status != 'error') {
                        getUserinfo();
                        $('#pp').window('close');
                        $('#login_btn').hide();


                    }
                    else {
                        refresh();

                    }


                }, 'json')
        });

        $("#loginout_div").hide();
        $("#login_btn").hide();

        //  getUserinfo();
    });


</script>
</html>